<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin extends CI_Controller {

    var $data;
    
    public function __construct()
    {
        parent::__construct();
        $this->load->helper('url');
        $this->data = array(
            'title' => 'Admin Page [name_admin]', // @todo изменить 
            'msg' => ''
        );
        
    }

	public function index()
	{
            $this->load->view('admin_page', $this->data);
	}
        public function install(){
            
            /*$config['hostname'] = "localhost";
            $config['username'] = "root";
            $config['password'] = "";
            $config['database'] = "";
            $config['dbdriver'] = "mysql";
            $config['dbprefix'] = "";
            $config['pconnect'] = FALSE;
            $config['db_debug'] = TRUE;

            $this->load->model('install', '', $config);*/
            
            $this->load->database('free');
            $this->load->dbutil();
            $this->load->dbforge();
            foreach($this->dbutil->list_databases() as $db)
               if($db == 'db_bug_report')
               {
                   $this->dbforge->drop_database($db);
               }
            $this->dbforge->create_database('db_bug_report');
            
            
            $this->load->database();
            $this->load->dbforge();
            $this->dbforge->add_field("label varchar(100) NOT NULL DEFAULT 'default label'");
        }
}